//
//  RelatedNewsViewController.m
//  ToYourHeartNews
//
//  Created by XJ－Mac on 16/2/9.
//  Copyright © 2016年 www.lanou3g.com 蓝鸥. All rights reserved.
//

#import "RelatedNewsViewController.h"
#import "BlackManager.h"
#import "SetBlack.h"
#import "MBProgressHUDManager.h"//加载时的小菊花
@interface RelatedNewsViewController ()

@end

@implementation RelatedNewsViewController
-(void)dealloc
{
    [_pathhtml release];
    [_pathstr release];
    [super dealloc];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
     self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"iconfont-newlisticon06"] style:UIBarButtonItemStylePlain target:self action:@selector(BackAction)] autorelease];
    //webView
    UIWebView *webVC = [[UIWebView alloc]initWithFrame:CGRectMake(0, -65, self.view.frame.size.width, self.view.frame.size.height + 65)];
    webVC.backgroundColor = [UIColor yellowColor];
    [self.view addSubview:webVC];
    if ([BlackManager sharedInstance].isNight) {
        [webVC stringByEvaluatingJavaScriptFromString:@"document.getElementsByTagName(‘body‘)[0].style.background=‘#F6F7F3‘"];
    }
    //webView适应
    webVC.scalesPageToFit = YES;
    if (_pathstr.length != 0) {
        //添加加载小菊花
        [MBProgressHUDManager showHUDtoView:self.view string:@"努力加载中"];
        [webVC loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:_pathstr]]];
        [MBProgressHUDManager removeHUD];
    }else{
        //添加加载小菊花
        [MBProgressHUDManager showHUDtoView:self.view string:@"努力加载中"];
        [webVC loadHTMLString:_pathhtml baseURL:[NSURL URLWithString:_pathhtml]];
        [MBProgressHUDManager removeHUD];
    }
    [webVC release];

}
-(void)BackAction
{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
